package cn.bdqn.service.impl;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;

import cn.bdqn.mapper.PostMapper;
import cn.bdqn.pojo.Post;
import cn.bdqn.service.PostService;
 
@Service("PostService")
public class PostServiceImpl implements PostService{

	@Resource
	public PostMapper postMapper;
	
	  @Override
	    public List<Post> findPostAll(String postName, Integer deptId, Integer isEnable,
	                                  Integer currentPageNo,Integer pageSize) {
	        currentPageNo = (currentPageNo-1)*pageSize;
	        List<Post> postList = postMapper.findPostAll(postName,deptId,isEnable,currentPageNo,pageSize);
	        return postList;
	    }

	    @Override
	    public int count(String postName, Integer deptId, Integer isEnable) {
	        int count = postMapper.count(postName,deptId,isEnable);
	        return count;
	    }

	    @Override
	    public Post getPost(Integer postId) {
	        Post post = postMapper.getPost(postId);
	        return post;
	    }

	    @Override
	    public int getAdd(Post post) {
	        int flag = postMapper.getAdd(post);
	        return flag;
	    }

	    @Override
	    public int modifyPost(Post post) {
	        int flag = postMapper.modifyPost(post);
	        return flag;
	    }

	    @Override
	    public int delPost(Integer postId) {
	        int flag = postMapper.delPost(postId);
	        return flag;
	    }

	    @Override
	    public List<Post> findPostName(Integer deptId) {
	        List<Post> postList = postMapper.findPostName(deptId);
	        return postList;
	    }

	    @Override
	    public Post findPostCode(Integer postId) {
	        Post post = postMapper.findPostCode(postId);
	        return post;
	    }
}
